package com.hRpc;

import com.hrpc.discovery.RegisterConfig;
import com.hrpc.hRpcBootStarp;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class hRpcStarter implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        //run方法会在容器启动成功之后执行
        Thread.sleep(5000);

        hRpcBootStarp.getInstance()
                .application("first-rpc-provider")
                //定义注册中心
                .register(new RegisterConfig("zookeeper://127.0.0.1:2181"))
                //配置序列化协议
                .serialize("jdk")
                //发布服务
                .scan("com.hRpc.impl")
//                .publish(service)
                //启动netty相关服务
                .start();
    }
}
